﻿@using System.Collections.Generic
@using System.Text.Json

<div>
    <h2>Touch position</h2>
    <p>
        Output: <span id="output">@message</span>
    </p>
    <p>
        <button id="touch_input"
                @ontouchstart=OnTouch
                @ontouchcancel=OnTouch
                @ontouchenter=OnTouch
                @ontouchleave=OnTouch
                @ontouchend=OnTouch
                @ontouchmove=OnTouch>
            TOUCH ME
        </button>
    </p>
    <p>
        <button @onclick="Clear">Clear</button>
    </p>
</div>

@code {

    string message;

    void OnTouch(TouchEventArgs e)
    {
        message += $"{e.Type},";
        Console.WriteLine(JsonSerializer.Serialize(e));
    }

    void Clear()
    {
        message = string.Empty;
    }
}
